#ifndef BASE_TYPES_H
#define BASE_TYPES_H

#ifndef NULL
#define NULL 0
#endif // NULL

typedef signed char         int8;
typedef short               int16;
typedef int                 int32;
#ifdef _MSC_VER
typedef __int64             int64;
#else
typdef long long            int64;
#endif // _MSC_VER

typedef unsigned char       uint8;
typedef unsigned short      uint16;
typedef unsigned int        uint32;
#ifdef _MSC_VER
typedef unsigned __int64    uint64;
#else
typedef unsigned long long  uint64;
#endif // _MSC_VER

// Some useful numerical limits, ANSI standard.
// TODO: Maybe use limits.h instead.

const int8 kMaxInt8     = +127;
const int8 kMinInt8     = -127;
const uint8 kMaxUInt8   = +255;

const int16 kMaxInt16   = +32767;
const int16 kMinInt16   = -32767;
const uint16 kMaxUInt16 = +65535;

const int32 kMaxInt32   = +2147483647;
const int32 kMinInt32   = -2147483647;
const uint32 kMaxUInt32 = +4294967295;

const int64 kMaxInt64   = +9223372036854775807;
const int64 kMinInt64   = -9223372036854775807;
const uint64 kMaxUInt64 = +18446744073709551615;
                                     

// Disallows the copy constructor and operator= function.
// Should be used in the private: section.
#define DISALLOW_COPY_CONSTRUCTORS(TypeName)    \
    TypeName(const TypeName&);                  \
    void operator=(const TypeName&)

// Disallows the default constructor, copy constructor, and operator= function.
// Should be used in the private: section.
#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName)    \
    TypeName();                                     \
    DISALLOW_COPY_CONSTRUCTORS(TypeName)            \


// Some useful macros for deletion.

#ifndef SAFE_DELETE
#define SAFE_DELETE(p) {    \
    if (p) {                \
        delete (p);         \
        (p)=0;              \
    }                       \
}
#endif // SAFE_DELETE

#ifndef SAFE_DELETE_ARRAY
#define SAFE_DELETE_ARRAY(p) {  \
    if (p) {                    \
        delete[] (p);           \
        (p)=0;                  \
    }                           \
}
#endif // SAFE_DELETE_ARRAY

#endif // BASE_TYPES_H
